/*!
    \copyright  Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
                All rights reserved.
                Confidential and Proprietary - Qualcomm Technologies, Inc.
    \version    
    \file       dfu_transport_relay.h
    \ingroup    dfu
    \brief      Control and Manage Data Transfer to Peer through Tranport Layer.
*/

#ifdef INCLUDE_TRANSPORT_LAYER_RELAY

#include <message.h>

extern TaskData dfu_transport_relay_task;

/*! Get pointer to dfu_transport_relay task. */
#define dfuTransportRelay_GetMsgHandler()  (&dfu_transport_relay_task)

/*! \brief Message IDs from Upgrade Peer to main application task */
typedef struct
{
    uint32 absolute_offset;
    uint32 size;
} DFU_TRANSPORT_RELAY_DATA_REQ_T;

/*! \brief Initialise Device DFU Transport Relay task

    Initialise DFU Transport Relay task when INCLUDE_TRANSPORT_LAYER_RELAY is included by dfu 
    task and assign dfu_transport_relay_task_data

    \return none
*/
void DfuTransportRelayInit(void);

/*! \brief Check if the self stream is active in data transfer

    \return True, if self stream is active
*/
bool DfuTrasportRelayIsSelfStreamActive(void);

/*! \brief Check if the peer  stream is active in data transfer

    \return True, if peer stream is active
*/
bool DfuTrasportRelayIsPeerStreamActive(void);

/*! \brief Start Data transfer through transport relay

    \return None
*/
void DfuTransportRelayStartDataTransfer(void);

/*! \brief Load Data Bytes Request info from Upgrade library into task_data

    Store Offset and Size in the data bytes request for the upgrade library

    \return None
*/
void DfuTransportRelayLoadUpgradeDataReq(void);

/*! \brief Load Data Bytes Request info from Upgrade Peer library into task_data

    Store Offset and Size in the data bytes request for the upgrade peer library

    \return None
*/
void DfuTransportRelayLoadPeerDataReq(void);

/*! \brief Deinitialise Device DFU Transport Relay task
    \return None
*/
void DfuTransportRelayDestroy(void);

#else
#define DfuTransportRelayInit(void)                     ((void)0)
#define DfuTrasportRelayIsSelfStreamActive(void)        (FALSE)
#define DfuTrasportRelayIsPeerStreamActive(void)        (FALSE)
#define DfuTransportRelayStartDataTransfer(void)        ((void)0)
#define DfuTransportRelayLoadUpgradeDataReq(void)       ((void)0)
#define DfuTransportRelayLoadPeerDataReq(void)          ((void)0)
#define DfuTransportRelayDestroy(void)                  ((void)0)
#endif
